<?php
namespace app\admin\model;
use think\Model;
use think\Db;


class Statistics extends Model
{
	public function getDataAll($status){
		
		$class_name = input('get.class_name');
		$major_id = input('get.major_id');
		$subject_id = input('get.subject_id');
		//只显示状态为传过来的值的数据
		$where ="status = $status";

		if ($class_name) {
			$where .= " and class_name = '$class_name'";
		}

		if ($major_id) {
			$where .= " and major_id = $major_id";
		}
		
		if ($subject_id) {
			$where .= " and subject_id = $subject_id";
		}

		// echo $where;
		//当前$this指Admin模型
		$data = Db::name('topic')->where($where)->paginate(10,false,['query'=>array('class_name'=>$class_name,'major_id'=>$major_id,'subject_id'=>$subject_id)]);
		// dump($data);
		return $data;
	} 

	
	
}